﻿<Window x:Class="NUnitResultsExplorer.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:n="clr-namespace:NUnitResultsExplorer"
        xmlns:c="clr-namespace:NUnitResultsExplorer.Controls"
        Title="NUnit Results Explorer" Height="600" Width="800">
    <DockPanel>
        <Menu DockPanel.Dock="Top">
            <MenuItem Header="_File">
                <MenuItem Command="Open" />
                <MenuItem Command="Close" />
            </MenuItem>
            <MenuItem Header="_Help">
                <MenuItem Command="n:NUnitExplorerCommands.AboutCommand" />
            </MenuItem>
        </Menu>
        <StatusBar DockPanel.Dock="Bottom">
            <StatusBarItem>
                <TextBlock Text="Welcome to NUnitResultsExplorer!" />
            </StatusBarItem>
        </StatusBar>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300" />
                <ColumnDefinition Width="3" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <TreeView Name="trv" ItemsSource="{Binding}">
                <TreeView.ItemContainerStyle>
                    <Style TargetType="TreeViewItem">
                        <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
                        <Setter Property="ContextMenu">
                            <Setter.Value>
                                <ContextMenu>
                                    <MenuItem Command="n:NUnitExplorerCommands.ExpandAllCommand" />
                                    <MenuItem Command="n:NUnitExplorerCommands.CollapseAllCommand" />
                                </ContextMenu>
                            </Setter.Value>
                        </Setter>
                        <EventSetter Event="PreviewMouseRightButtonDown" Handler="trv_PreviewMouseRightButtonDown" />
                    </Style>
                </TreeView.ItemContainerStyle>
                <TreeView.ItemTemplate>
                    <HierarchicalDataTemplate ItemsSource="{Binding SubExpandables}">
                        <DockPanel Margin="1">
                            <c:StatusIndicator Margin="0,0,8,0" DockPanel.Dock="Left" VerticalAlignment="Center" Width="15" Height="15" DataContext="{Binding Object.Status, Converter={StaticResource statusToBrushConverter}}" />
                            <TextBlock Text="{Binding Object.Name, Converter={StaticResource nameToStringConverter}}" />
                        </DockPanel>
                    </HierarchicalDataTemplate>
                </TreeView.ItemTemplate>
            </TreeView>
            <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" />
            <ContentControl Grid.Column="2" DataContext="{Binding ElementName=trv, Path=SelectedItem.Object}" Content="{Binding}"  />
        </Grid>
    </DockPanel>
</Window>
